/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package common.model.message;

import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

/**
 *
 * @author nicolas
 */
public class SetGuideMessage implements Message {

    protected boolean guide = true;
    protected String userName = "NONAME";

    public SetGuideMessage(String userName, boolean guide) {
        this.userName = userName;
        this.guide = guide;
    }

    public boolean isGuide() {
        return guide;
    }

    public String getUserName() {
        return userName;
    }

    /**
     * Unmarshaller constructor
     * @param line
     */
    public SetGuideMessage(String line) {
        StringTokenizer st = new StringTokenizer(line, " ");
        List<Object> listElems = new ArrayList();
        while (st.hasMoreElements()) {
            listElems.add(st.nextElement());
        }
        this.userName = (String)listElems.get(1);
        this.guide = Boolean.parseBoolean((String)listElems.get(2));
    }


    @Override
    public String messageToString() {
        return "SETGUIDE " + userName + " " + guide;
    }
}
